-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Synchronize relation between contacts #1020
Conversation
BundleMonFiles updated (2)
Unchanged files (6)
Total files change +1020B +0.05% Groups updated (1)
Unchanged groups (2)
Final result: ✅ View report in BundleMon website ➡️ |
} catch (error) { | ||
log.error('Error updating related contact', error) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So createRelatedContact
and updateRelatedContact
are equal ? Maybe you can use only one function called upsertRelatedContact
. But it's your choice, sometimes it's good to have the different path explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I prefer to separate the different actions.
(Initially, I was also thinking of using another CC helper in this function).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the code because it wasn't working when removing a “relationTypes”.
This is a problem on the cozy-client side, so I'm updating “manually” to avoid delaying the feature.
See issue cozy/cozy-client#1560
Some questions, but very pleasant to read. Looks a lot like clean code. |
Following on from the work started on this PR #985. The aim is to synchronize relationship changes between the contacts concerned.
0e679b7
to
bea68e3
Compare
I had to start with a special case for "me" update, because in Cozy Contacts, relations were stored only in the contact who created the relation. So when "me" was updated, a relation of me could have been deleted, and it was impossible to know which one easily, so it was impossible to know if the contact should be removed from the extension. With cozy/cozy-contacts#1020, relations are propagated to the target contact. So we will get a realtime event and we will be able to check if the contact must be displayed or not without any special case. And I can also check that a contact is related to me directly by checking its relationships now.
I had to start with a special case for "me" update, because in Cozy Contacts, relations were stored only in the contact who created the relation. So when "me" was updated, a relation of me could have been deleted, and it was impossible to know which one easily, so it was impossible to know if the contact should be removed from the extension. With cozy/cozy-contacts#1020, relations are propagated to the target contact. So we will get a realtime event and we will be able to check if the contact must be displayed or not without any special case. And I can also check that a contact is related to me directly by checking its relationships now.
Following on from the work started on this PR #985.
The aim is to synchronize relationship changes between the contacts concerned.